package com.student.dao;

import com.student.bean.Admin;
import com.student.utils.DBMysql;

import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * 是否登录
 */
public class AdminDAO {

    public static Admin isLogin(String username, String password) {
        String sql = "select * from s_admin where account=? and pwd=?";
        ResultSet res = DBMysql.query(sql, username, password);//n获取到结果集合


        Admin admin1 = null;
        try {
            admin1 = new Admin(res.getString("account"),
                    res.getString("pwd"),
                    res.getString("xm"),
                    res.getString("sta"),
                    res.getString("pow"));
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }
        return admin1;
    }
}